<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1 align='center' style='color:red;'>首页</h1>
<!--    下面两行代码不同时在页面上呈现，根据是否登录二选一关系-->
    {% if name %}
<!--    如果name有值，说明用户登录过，判断为true 显示你好-->
    <p>
        <a href="/loginout/">你好！{{name}}</a>
    </p>
    {% else %}
<!--    如果name没有值，说明用户还没有登录，判断为false，显示超链接，跳转登录-->
    <!--     http://127.0.0.1:8080/login  等价于 /login-->
    <a href="/login">跳转登录页面</a>
    {% endif %}
    <!--搜索功能 -->
    <div>
         <form action="/index/" method="get">
             <input type="text" placeholder="请输入" name="keywords">
             <input type="submit" value="搜一下">
         </form>
    </div>
<!--    购物车-->
    <div>
        <form action="/shoppingcar/" method="get">
            <input type="text" name="uid" value="{{uid}}" hidden>
            <input type="submit" value="我的购物车">
        </form>
    </div>



        <table>
            <thead>
                <tr>
                    <th>商品序号</th>
                    <th>商品名称</th>
                    <th>商品图片</th>
                    <th>商品价格</th>
                    <th>商品数量</th>
                </tr>
            </thead>
            <tbod>
                {% for good in good %}
                <tr>
                    <td>{{good.gid}}</td>
                    <td>
                        <a href="/goodinfo/?gid={{good.gid}}">{{good.name}}</a>
                    </td>
                    <td><img src={{good.imgsrc}} width="50" height="50"></td>
                    <td>{{good.price}}</td>
                    <td>{{good.count}}</td>
                </tr>
                {% endfor %}
            </tbod>
        </table>
        <tfoot>
            <tr>
                <th colspan="5">
                    {% for item in pagelist %}
                    <a href="/index/?page={{item}}">{{item}}</a>
                    {% endfor %}
<!--                    <a href="/index/?page=2">2</a>
                    <a href="/index/?page=3">3</a>
                    <a href="/index/?page=4">4</a>-->
                </th>
            </tr>
        </tfoot>
    

</body>
</html>